package com.scpii.universal.service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.scpii.universal.hibernate.dao.BaseDao;
import com.scpii.universal.hibernate.entity.AppPageTab;
import com.scpii.universal.hibernate.intface.BaseInterface;
import com.scpii.universal.util.SpringBeanFactory;

public class AppPageTabService implements BaseInterface<AppPageTab> {
	private static final Logger log = LoggerFactory.getLogger(AppPageTabService.class);
//	private BaseDao<AppPageTab> appPageTabDao = SpringBeanFactory.appPageTabDao;
	private BaseDao<AppPageTab> appPageTabDao;
	public AppPageTab get(Integer id) throws Exception {
		return appPageTabDao.get(id);
	}

	public List<AppPageTab> getAll() throws Exception {
		return appPageTabDao.getAll();
	}

	public AppPageTab get(String propertyName, Object value) throws Exception {
		return null;
	}

	public List<AppPageTab> getList(String propertyName, Object value)
			throws Exception {
		return null;
	}

	public Long getTotalCount() throws Exception {
		return null;
	}

	public void save(AppPageTab obj) throws Exception {

	}

	public void update(AppPageTab obj) throws Exception {

	}

	public void delete(AppPageTab obj) throws Exception {

	}

	public void delete(Integer id) throws Exception {

	}

	public List<AppPageTab> hqlGetList(String hql, Map<String, Object> argsMap)
			throws Exception {
		return appPageTabDao.hqlGetList(hql, argsMap);
	}

	public void hqlUpdate(String namedHqlQuery, Map<String, Object> argsMap)
			throws Exception {
		appPageTabDao.hqlUpdate(namedHqlQuery, argsMap);
	}

	public Long hqlGetNums(String namedHqlQuery, Map<String, Object> argsMap)
			throws Exception {
		return appPageTabDao.hqlGetNums(namedHqlQuery, argsMap);
	}

	public List<AppPageTab> sqlGetList(String sqls, Map<String, Object> argsMap)
			throws Exception {
		return appPageTabDao.sqlGetList(sqls, argsMap);
	}

	public void sqlUpdate(String sqls, Map<String, Object> argsMap)
			throws Exception {
		appPageTabDao.sqlUpdate(sqls, argsMap);
	}

	public Long sqlGetNum(String sqls, Map<String, Object> argsMap)
			throws Exception {
		return appPageTabDao.sqlGetNum(sqls, argsMap);
	}
	
	/**
	 * 根据父级ID，获得下一级页面列表
	 * @param parentPageId
	 * @return
	 * @throws Exception
	 * @author 甘建新
	 * 2012-7-16下午03:24:00
	 */
	public AppPageTab getPagesListByPageIdAppId(int appId,int pageId)throws Exception{
		List<AppPageTab> appPagesList = new ArrayList<AppPageTab>();
		Map<String, Object> argsMap = new HashMap<String, Object>();
		argsMap.put("appId", appId);
		argsMap.put("pageId", pageId);
		appPagesList = this.hqlGetList("GET_PAGE_BY_PAGEID_APPID", argsMap);
		if (appPagesList!=null && appPagesList.size()==1) {
			return appPagesList.get(0);
		}
		return null;
	}
	//Setter

	public void setAppPageTabDao(BaseDao<AppPageTab> appPageTabDao) {
		this.appPageTabDao = appPageTabDao;
	}
	
}